package com.loeng.module.infra.dal.mysql.demo.demo02;

import com.loeng.framework.common.pojo.PageResult;
import com.loeng.framework.mybatis.core.mapper.BaseMapperX;
import com.loeng.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.loeng.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryPageReqVO;
import com.loeng.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 示例分类 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface Demo02CategoryMapper extends BaseMapperX<Demo02CategoryDO> {

    default PageResult<Demo02CategoryDO> selectPage(Demo02CategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<Demo02CategoryDO>()
                .likeIfPresent(Demo02CategoryDO::getName, reqVO.getName())
                .eqIfPresent(Demo02CategoryDO::getParentId, reqVO.getParentId())
                .betweenIfPresent(Demo02CategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(Demo02CategoryDO::getId));
    }

}